home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************************
- *
- * @@@BUILDINFO@@@ 31stackPane.jsx 1.0.0.47 07-Feb-2005
- * Copyright 2005 Adobe Systems Incorporated
- * All Rights Reserved.
- *
- * NOTICE: All information contained herein is, and remains the property of
- * Adobe Systems Incorporated and its suppliers, if any. The intellectual
- * and technical concepts contained herein are proprietary to Adobe Systems
- * Incorporated and its suppliers and may be covered by U.S. and Foreign
- * Patents,patents in process,and are protected by trade secret or copyright
- * law. Dissemination of this information or reproduction of this material
- * is strictly forbidden unless prior written permission is obtained from
- * Adobe Systems Incorporated.
- **************************************************************************/
-
- // Code to add to the Stack pane
- // The output field of the stack pane is a list box
-
- // Set the stack trace window to the new stack
-
- window.stack.update = function (text)
- {
- var frames = text.split ('\n');
- // if the last line is empty, discard it
- if (frames [frames.length-1].length == 0)
- frames.pop();
- var oldMax = this.output.items.length - 1;
- var newSize = frames.length;
- for (var frame = 0; frame < newSize; frame++)
- {
- var curFrame = frames [frame];
- if (curFrame == "[toplevel]")
- curFrame = localize ("$$$/ESToolkit/Panes/Stack/Toplevel=[Top Level]");
- $.bp (curFrame.length == 0);
- if (oldMax < frame)
- this.output.add ("item", curFrame);
- else
- this.output.items [frame].text = curFrame;
- }
- // delete excess frames
- while (this.output.items.length > newSize)
- this.output.remove (this.output.items.length - 1);
- // Select the last frame
- this.output.selection = this.output.items.length - 1;
- }
-
- // Grow the stack by adding the supplied text
- // TBD: Remove this
-
- window.stack.grow = function (text)
- {
- // the new stack lines are newline-separated
- // remove the placeholder text
- if (!this.running)
- this.running = true, this.output.removeAll();
-
- var lines = text.split ('\n');
- // the last line is empty
- lines.pop();
- for (var i = 0; i < lines.length; i++)
- {
- var line = lines [i];
- if (line == "[toplevel]")
- line = localize ("$$$/ESToolkit/Panes/Stack/Toplevel=[Top Level]");
- this.output.add ("item", line);
- }
- this.output.selection = this.output.items.length - 1;
- }
-
- // Shrink the stack to the given level
- // TBD: remove this old code
-
- window.stack.shrink = function (level)
- {
- while (this.output.items.length > level)
- this.output.remove (this.output.items.length - 1);
- this.output.selection = this.output.items.length - 1;
- }
-
- // Clear the stack
-
- window.stack.clear = function()
- {
- var text = localize ("$$$/ESToolkit/Panes/Stack/NoStack=[no stack]");
- this.output.removeAll();
- this.output.add ("item", text);
- this.running = false;
- }
-
- // Switch to the bottom stack frame.
-
- window.stack.switchToBottom = function()
- {
- if (currentDebugger.state == Debugger.STOPPED)
- currentDebugger.switchFrame (0);
- }
-
- // The callback for the output list box is activated when the user
- // selects a different stack frame. In this case, the debugger displays
- // the selected stack frame if it is halted. If not, nothing happens.
-
- window.stack.output.onChange = function()
- {
- if (this.selection && currentDebugger.state == Debugger.STOPPED)
- currentDebugger.switchFrame (this.items.length - 1 - this.selection.index);
- }
-
- window.stack.clear();
-